Skip to content

fix(ui): support clipboard paste in filter and command inputs#202

Open
nick4eva wants to merge 2 commits into
clawscli:mainfrom
nick4eva:add-ability-to-paste-search-string-from-clipboard
Open

fix(ui): support clipboard paste in filter and command inputs#202
nick4eva wants to merge 2 commits into
clawscli:mainfrom
nick4eva:add-ability-to-paste-search-string-from-clipboard

Conversation

@nick4eva

Copy link
Copy Markdown
Contributor

Filter views only routed tea.KeyPressMsg to their textinput, so bracketed paste (Ctrl+Shift+V, tmux paste) was dropped and the textinput's built-in Ctrl+V never received its clipboard-read result.

Forward paste and other textinput-bound messages to the focused filter input in the resource browser, service browser, log view, tag search view and multi selector, and accept tea.PasteMsg in command mode.

Closes #201

Filter views only routed tea.KeyPressMsg to their textinput, so
bracketed paste (Ctrl+Shift+V, tmux paste) was dropped and the
textinput's built-in Ctrl+V never received its clipboard-read result.

Forward paste and other textinput-bound messages to the focused filter
input in the resource browser, service browser, log view, tag search
view and multi selector, and accept tea.PasteMsg in command mode.

@yimsk yimsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding paste support and the accompanying tests. Overall, this looks like a good change.

Two things stood out while reviewing it:

  1. The clipboard result from Ctrl+V does not return to the command input in command mode.
  2. Mouse-wheel scrolling stops working in LogView while the filter is active.

Could you please take a look at these two cases?

Comment thread internal/app/app.go
Comment thread internal/view/log_view.go
Address review feedback on clawscli#202:

- Ctrl+V in command mode never inserted text because bubbles returns
  the clipboard read as an unexported message type. Add clipboard.Paste,
  which reads the clipboard and re-enters as a public tea.PasteMsg, and
  intercept ctrl+v in CommandInput before delegating to the textinput.
- Mouse-wheel scrolling stopped working in LogView while the filter was
  active; mouse messages now bypass the filter fallback to the viewport.
@nick4eva

Copy link
Copy Markdown
Contributor Author

Thanks for feedback.
I've added fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't paste from clipboard into the search filter

2 participants